Loading page, please wait ...

I believe that distance calculation is the core of GIS. In the vast realm of GIS, distance is nothing short of a golden thread that weaves through every map, analysis, and decision. The invisible ruler measures not just space but the essence of connectivity, accessibility, and relationships within our world. From helping urban planners design efficient transportation networks to aiding ecologists in understanding wildlife migration patterns, distance in GIS is our compass, guiding us toward informed solutions and deeper insights. So, whether you are exploring the bustling streets of a city or the remote corners of our planet, always remember: in the realm of GIS, distance is not just a number; it is a gateway to discovery, an enabler of change, and the key to unlocking the secrets of our spatial world.
This is an educational project to create a series of applications that can calculate the distance between two points. The current page is the prototype for calculation of distance based on cartesian coordinate system. Links at the end of every page will take you to a more advanced approach.

Calculated Distance


Enter the Latitude of the first point

Enter the Longitude of the first point

Enter the Latitude of the second point

Enter the Longitude of the second point


Result:



from js import document, alert #imported this to create a proxy function that will not execute when the page is loaded from pyodide import create_proxy def button_click(event): FirstLat = document.getElementById("FirstLat").value FirstLong= document.getElementById('FirstLong').value SecLat= document.getElementById('SecLat').value SecLong= document.getElementById('SecLong').value #since the input values will be string, converting to float dx = float(SecLat) - float(FirstLat) dy = float(SecLong) - float(FirstLong) dsquared = dx*dx + dy*dy calculated_distance = dsquared**0.5 document.getElementById("Distance").innerHTML = 'Calculated Distance: ' + str(calculated_distance) def setup(): # The page is ready, clear the "page loading" document.getElementById("msg").innerHTML = '' # Create a JsProxy for the callback function click_proxy = create_proxy(button_click) # Set the listener to the callback e = document.getElementById("button") e.addEventListener("click", click_proxy) setup()

To calculate the distance based on the curvature of the Earth, please click the following link!

Distance Calculator Based on the Curvature of the Earth